<%@ page language="java" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
    <jsp:include page="/common/common.jsp"/>
</head>
<body class="page-header-fixed">
<jsp:include page="/common/header.jsp"/>
<div class="clearfix">
</div>
<div class="page-container">
    <div class="page-sidebar-wrapper"><jsp:include page="/common/menu.jsp"/></div>
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="row">
                <div class="col-md-12">
                    <form class="form-horizontal form-row-seperated" id="form" method="post" action="${path}/adShow/save">
                        <div class="portlet box purple">
                            <div class="portlet-title">
                                <div class="caption">
                                    <i class="fa fa-shopping-cart"></i>广告详情
                                </div>
                                <div class="actions btn-set">
                                    <a href="javascript:history.go(-1);" class="btn default"><i
                                            class="fa fa-angle-left"></i> 返回</a>
                                    <a href="javascript:location.reload();" class="btn green"><i
                                            class="fa fa-reply"></i> 重置</a>
                                    <button type="button" onclick="save()" class="btn blue"><i class="fa fa-check"></i> 保存
                                    </button>
                                    
                                </div>
                            </div>
                           <div class="portlet-body">
                                <div class="tabbable">
                               
                                    <div class="tab-content no-space">
                                        <div class="tab-pane active" id="tab_general">
                                            <div class="form-body">
                                                
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">广告名称:
                                                        <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-5">
                                                        <input type="text" id="name" name="name"
                                                               class="form-control measure-input" datatype="*1-80"
                                                               value="${data.name}"/>
                                                    </div>
                                                    <div class="col-md-5">
                                                        &nbsp;可输入<b><span id="title_len">80</span></b> 个字符
                                                    </div>
                                                </div> 
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">url源地址:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-5">
                                                        <input id="urlsource" name="urlsource" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.urlsource}"/>
                                                    </div>
                                                    
                                                </div>
                                                 <div class="form-group">
                                                 	<label class="col-md-2 control-label">url目标地址:
                                                    <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-5">
                                                        <input id="urltarget" name="urltarget" type="text"
                                                               class="form-control tags medium"
                                                               value="${data.urltarget}"/>
                                                    </div>
                                                 </div>
                                                <div class="form-group">
                                                <label class="col-md-2 control-label">产品有效时间<span class="required">*</span></label>
                                                
                                        			<div class="col-md-4">
                                            			<div class="input-group input-large date-picker input-daterange"
                                                 		data-date-format="yyyy-mm-dd">
                                                		<input type="text" class="form-control" id="adbegin" name="adbegin" value="${data.adbegin}"
                                                       readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                                                		<span class="input-group-addon">to</span>
                                                		<input type="text" class="form-control" id="adend" name="adend" value="${data.adend}"
                                                       readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                                            			</div>
                                        			</div>
                                        			</div>
                                        		<div class="form-group">
                                        			<label class="col-md-2 control-label">状态:
                                                        <span class="required">*</span>
                                                    </label>
                                                    <div class="col-md-3">
                                                        <select name="status" class="form-control">
                                                            <option value="0" <c:if test="${0== data.status }">selected="selected" </c:if> >已发布</option>
                                                        	<option value="1" <c:if test="${1== data.status }">selected="selected" </c:if> >已下架</option>
                                                        	<option value="2" <c:if test="${2== data.status }">selected="selected" </c:if> >审核中</option>
                                                        	<option value="3" <c:if test="${3== data.status }">selected="selected" </c:if> >审核不通过</option>
                                                        </select>
                                                    </div>
                                        		</div>
                                            </div>
										</div>
                                     </div>
                            </div>
                          </div>
                            <div class="portlet-title">
                                <div class="actions btn-set">
                                    <a href="javascript:history.go(-1);" class="btn default"><i
                                            class="fa fa-angle-left"></i> 返回</a>
                                    <a href="javascript:location.reload();" class="btn green"><i
                                            class="fa fa-reply"></i> 重置</a>
                                    <button type="button" onclick="save()" class="btn blue"><i class="fa fa-check"></i> 保存
                                    </button>
                                </div>
                            </div>
                        </div> 
                        <input type="hidden" id="id" name="id" value="${data.id}">
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/common/footer.jsp"/>
<script type="text/javascript" src="${path}/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/calendar/WdatePicker.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js"></script>
<script type="text/javascript" src="${path}/assets/scripts/custom/components-form-tools.js"></script>
<script type="text/javascript" src="${path}/assets/scripts/biz/ajaxfileupload.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/district/linkagesel-min.js"></script>


<script>
var editor, form;
$(function () { 
    form = $("form").Validform({
       tiptype: function (msg, o, cssctl) {
            //msg：提示信息;
            //o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
            //cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
            if (!o.obj.is("form")) {//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
                var objtip = o.obj.siblings(".Validform_checktip");
                cssctl(objtip, o.type);
                objtip.text(msg);
            } else {
                var objtip = o.obj.find("#msgdemo");
                cssctl(objtip, o.type);
                objtip.text(msg);
            }
        }, 
        postonce: true,
        showAllError: true,
        callback: function () {
            save();
        }
    });
});
    
    function save() {       
        if ($("#name").val()=='') {
            alert("广告名称不能为空");
            return;
        }
        if ($("#urlsource").val()=='') {
            alert("url源地址不能为空");
            return;
        }
        if ($("#urltarget").val()=='') {
            alert("url目标地址不能为空");
            return;
        }
        if ($("#adbegin").val()=='') {
            alert("广告开始时间不能为空");
            return;
        }
        if ($("#adend").val()=='') {
            alert("广告结束时间不能为空");
            return;
        }
        if ($("#status").val()=='') {
            alert("状态不能为空");
            return;
        }
        $("#form").submit();
	}

</script>
</body>
</html>